﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace UnitTests.UnitTestHelpers
{
    public class TempFolder : IDisposable
    {
        private string _foldername = string.Empty;

        public string FolderName { get { return _foldername; } }

        public TempFolder(string name)
        {
            _foldername = Path.Combine(UnitTestSettings.TempTestPath, name);

            if (!Directory.Exists(_foldername))
                Directory.CreateDirectory(_foldername);
        }

        #region IDisposable Members

        public void Dispose()
        {
            if (Directory.Exists(_foldername))
                Directory.Delete(_foldername, true);
        }

        #endregion
    }


}
